from django.db import models

# Create your models here.

class ClassifyBySex(models.Model):
    name = models.CharField(max_length=20, verbose_name="男/女分类")

    class Meta:
        verbose_name = '男/女分类'
        verbose_name_plural = verbose_name

    def __str__(self):
        return "{}".format(self.name)


class ClassifyBySeason(models.Model):
    name = models.CharField(max_length=20, verbose_name="季节分类")

    class Meta:
        verbose_name = '季节分类'
        verbose_name_plural = verbose_name

    def __str__(self):
        return "{}".format(self.name)


class ClassifyByAge(models.Model):
    name = models.CharField(max_length=20, verbose_name="年龄分类")

    class Meta:
        verbose_name = '年龄分类'
        verbose_name_plural = verbose_name

    def __str__(self):
        return "{}".format(self.name)

class Type(models.Model):
    name = models.CharField(max_length=200,verbose_name="种类")

    class Meta:
        verbose_name = "种类"
        verbose_name_plural =verbose_name

    def __str__(self):
        return "{}".format(self.name)


class Market(models.Model):
    title = models.CharField(blank=False, null=False, max_length=100, verbose_name='商品名称', unique=True)
    desc = models.CharField(max_length=1024, verbose_name='商品简介', default='目前还没有简介...')
    price = models.CharField(max_length=100, verbose_name='价格',default='0')
    classify_bysex = models.ManyToManyField(ClassifyBySex)
    classify_byseason = models.ManyToManyField(ClassifyBySeason)
    classify_byage = models.ManyToManyField(ClassifyByAge)
    classify_bytype = models.ManyToManyField(Type)
    images = models.ImageField(null=True)


    class Meta:
        verbose_name = '商品信息'
        verbose_name_plural = verbose_name

    def __str__(self):
        return "{}".format(self.title)



